package whsw;

import whsw.tool.TableInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * 步骤一. 定义员工类
 *
 * 员工类需要具备的信息
 *
 * @author flutterdash@qq.com
 * @since 2021/6/20 13:24
 */
public class Employee implements TableInfo {

    protected int id;        // 编号
    protected String name;   // 姓名
    protected char sex;      // 性别
    protected int age;       // 年龄

    public Employee() {
    }

    public Employee(int id, String name, char sex, int age) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public List<String> getTitle() {
        ArrayList<String> title = new ArrayList<>();
        title.add("Id");
        title.add("Name");
        title.add("Sex");
        title.add("Age");
        return title;
    }

    @Override
    public List<String> toRecord() {
        ArrayList<String> line = new ArrayList<>();
        line.add(String.valueOf(id));
        line.add(name);
        line.add(String.valueOf(sex));
        line.add(String.valueOf(age));
        return line;
    }
}
